// TODO: 这个通过外部传参赋值
const rootPath = 'C:\\Users\\w2197\\source\\repos\\ABP-vNext-Vue'
const entityConfigName = 'Order'

const { createFile } = require('./files')
const { getConfig, getEntityConfig } = require('./config')
const { getTemplates, renderTemplate } = require('./templates')
const { autoDotnetEf } = require('./dotnet-ef')
const _ = require('lodash')
require('colors')

const config = {
	project: getConfig(),
	entity: getEntityConfig(entityConfigName),
}

// 获得模版 Map
const templates = getTemplates(rootPath, config)

_.forIn(templates, (template) => {
	// 渲染模版
	renderTemplate(template, config)

	// 写入模版
	createFile(template)
})

// dotnet-ef
autoDotnetEf(rootPath, config)
